package com.jianyun.jyzs.presenter;

import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
import com.jianyun.jyzs.model.UpdataPwdModel;
import com.jianyun.jyzs.model.imdoel.IUpdataPwdModel;
import com.jianyun.jyzs.view.iview.IUpdataPwdView;

/**
 * Created by yangshijun on 2018/5/28.
 */

public class UpdataPwdPresenter extends MvpBasePresenter<IUpdataPwdView> {
    /**
     * 修改密码
     *
     * @param enterpriseCode
     * @param userId
     * @param oldPwd
     * @param newPwd
     */
    public void updataPwd(String enterpriseCode, String userId, String oldPwd, String newPwd) {
        if (!isViewAttached()) {
            return;
        }
        getView().showLoading();
        UpdataPwdModel.getInstance().updataPwd(enterpriseCode, userId, oldPwd, newPwd, new IUpdataPwdModel.OnUpdataPwdListener() {
            @Override
            public void onSuccess() {
                getView().onSuccess();
            }

            @Override
            public void onFailed() {
                getView().onFailed();
            }

            @Override
            public void onException(String msg) {
                getView().onException(msg);
            }
        });
    }

}
